/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: WechatAppScheduleTask
 * Author:   wanghc
 * Date:     2020/03/13 09:45
 * Description: 微信小程序定时任务
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.ruoyi.quartz.task;

import com.ruoyi.quartz.service.IWechatAppScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * 〈一句话功能简述〉<br>
 * 〈微信小程序定时任务〉
 *
 * @author G3
 * @create 2020/03/13
 * @since 1.0.0
 */
@Component
@EnableScheduling
@Async
@Slf4j
public class WechatAppScheduleTask {

    @Autowired
    private IWechatAppScheduleService wechatAppScheduleService;

    /**
     * 每1个小时刷新一下微信接口全局调用凭证access_token
     */
    @Scheduled(cron = "0 0 0/1 * * ?")
    // @Scheduled(cron = "*/5 * * * * ?")
    public void refreshAccessToken() {
        wechatAppScheduleService.getAccessToken();
    }


}
